import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        //这是在服务器的控制台中打印了字符集，服务器看得到客户端看不到
        System.out.println("hello world");
        //这个是给resp的body写入hello world字符串，这个内容就会被HTTP响应返回给浏览器，显示到浏览器页面上
        resp.getWriter().write("hello world");
    }

}
